<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
require_once("dompdf/dompdf_config.inc.php");

class Dompdf_lib extends Dompdf {

    function createPDF($html, $filename = '', $stream = TRUE,$page="a4",$h="portrait") {
        $this->load_html($html);
        $this->set_paper($page, $h);//landscape 
        
        $this->render();
        if ($stream) {
            $this->stream($filename . ".pdf");
        } else {
            //return $this->output();
            $path="/home/patricio/public_html/acad/commons/personas/".$filename. ".pdf";
            //$path="/var/www/html/acad/commons/personas/".$filename. ".pdf";
            
            if( file_put_contents($path, $this->output()) ){
                return (base_url()."commons/personas/".$filename. ".pdf");
   
            } 
            else
                return (base_url()."commons/personas/".$filename. ".pdf");
                   
        }
    }

}

?>
